"use strict";

exports.__esModule = true;
exports.sumCellsHeights = sumCellsHeights;
/**
 * Calculates the total height of the merged cell.
 *
 * @param {Core} hotInstance The Handsontable instance.
 * @param {*} row The merged cell's row index.
 * @param {*} rowspan The merged cell height.
 * @returns {number}
 */
function sumCellsHeights(hotInstance, row, rowspan) {
  const {
    rowIndexMapper,
    stylesHandler
  } = hotInstance;
  const defaultHeight = stylesHandler.getDefaultRowHeight();
  let height = 0;
  for (let i = row; i < row + rowspan; i++) {
    if (!rowIndexMapper.isHidden(i)) {
      var _hotInstance$getRowHe;
      height += (_hotInstance$getRowHe = hotInstance.getRowHeight(i)) !== null && _hotInstance$getRowHe !== void 0 ? _hotInstance$getRowHe : defaultHeight;
      if (i === 0 && !stylesHandler.isClassicTheme()) {
        height += 1; // border-top-width
      }
    }
  }
  return height;
}